package com.xieyingwangluo.yxpart.bean;

import com.xieyingwangluo.yxpart.entity.PartModel;
import com.xieyingwangluo.yxpart.utils.DateUtil;
import lombok.Data;

import java.util.Date;

@Data
public class PartBean {
    private String noid;//兼职编号UUID
    private String name;//兼职名称
    private Integer salary;//兼职薪资
    private Integer type;//兼职类型
    private Integer unit;//单位（0小时，1日，2周，3月）
    private Integer labour;//工作时间
    private Date create_time;//发布时间(创建时间)
    private Integer setcycle;//结算周期
    private Integer hirnumb;//招聘人数
    private Integer sex;//性别要求
    private String content;//工作内容
    private String start_time;//工作开始时间
    private String end_time;//工作结束时间
    private String job_address;//工作地点
    private Integer state;//兼职状态
    private String merchant_id;//关联的商户id

    public PartBean(PartModel partModel) {
        noid = partModel.getNoid();
        name = partModel.getName();
        salary = partModel.getSalary();
        type = partModel.getType();
        unit = partModel.getUnit();
        labour = partModel.getLabour();
        create_time = partModel.getCreate_time();
        setcycle = partModel.getSetcycle();
        hirnumb = partModel.getHirnumb();
        sex = partModel.getSex();
        content = partModel.getContent();
        if (partModel.getStart_time() != null) {
            start_time = DateUtil.DtS(partModel.getStart_time(), "yyyy-MM-dd");
        }
        if (partModel.getEnd_time() != null) {
            end_time = DateUtil.DtS(partModel.getEnd_time(), "yyyy-MM-dd");
        }
        job_address = partModel.getJob_address();
        state = partModel.getState();
        merchant_id = partModel.getMerchant_id();
    }
}
